package com.hxalex.simulationhandle.accessbilityService.receiver.wifi;

import android.util.Log;
import android.view.accessibility.AccessibilityNodeInfo;

import com.hxalex.simulationhandle.accessbilityService.manger.WifiManger;
import com.hxalex.simulationhandle.accessbilityService.receiver.base.BaseReceiver;

/**
 * Created by hx_Alex on 2018/5/26.
 */

public class SearchWifiReceiver extends BaseReceiver {
    private static String  TAG="SearchWifiReceiver";
    private AccessibilityNodeInfo nowInfo;
    
    public SearchWifiReceiver(WifiManger wifiManger) {
        super(wifiManger);
        FLAG="搜索wifi命令";
    }


    public AccessibilityNodeInfo getNowInfo() {
        return nowInfo;
    }

    public void setNowInfo(AccessibilityNodeInfo nowInfo) {
        this.nowInfo = nowInfo;
    }

    @Override
    public void doSomething() {
        if(!isPrintCommandMsg)
        {
            Log.w("SearchWifiReceiver","开始执行"+FLAG);
            isPrintCommandMsg=true;
        }
        
        if(nowInfo==null) return;
                wifiManger.searchAvailableWifi(nowInfo);
                Log.i(TAG,"正在检索WIFI......");
                if(!wifiManger.isSearchWifi)
                {
                    Log.i(TAG,"WIFI检索完成......");
                    commandCompleteListener.commandCompleteListener();
                }
            }
    }

